<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="./黑马就业数据平台-模版/lib/axios.js"></script>
<body>
    <script>
        async function getProvinceData() {
            try {
                let res = sessionStorage.getItem('prov')
                if (res) {
                    console.log(JSON.parse(res).data)
                    return JSON.parse(res)
                } else {
                    res = await axios({ url: 'https://hmajax.itheima.net/api/province' }) // {message：'',list:['','']}
                    sessionStorage.setItem('prov', JSON.stringify(res))
                    console.log(res.data)
                }
            } catch (error) {
                console.log(error.response && error.response.data.message || '获取省份数据异常，检查网络')
            }
        }
        getProvinceData()
    </script>
</body>

</html>